//
//  XNCarInfoRequest.m
//  XINNingOA
//
//  Created by samuel on 2021/7/14.
//

#import "XNCarInfoRequest.h"

@implementation XNCarInfoRequest

- (NSString *)requestUrl
{
    return @"/api/CarInfo/LoadCarInfoList";
}

- (YTKRequestMethod)requestMethod
{
    return YTKRequestMethodGET;
}

- (id)requestArgument
{
    return @{
        @"carNo":@"",
        @"driverName":@"",
        @"usage":@"2",
        @"pageIndex":@"1",
        
    };
}


- (NSArray<XNCarInfoModel *> *)carInfoArray
{
    NSDictionary *response = [self responseJSONObject];
    if (self.success) {
        NSMutableArray *flowArray = [NSMutableArray array];
        NSArray *array = response[@"result"][@"data"];
        [array enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) {
            XNCarInfoModel *info = [XNCarInfoModel modelWithDictionary:obj];
            [flowArray addObject:info];
        }];
        return [NSArray arrayWithArray:flowArray];
        
    }else{
        return nil;
    }
}

@end
